import { ref } from 'vue'
import { defineStore } from 'pinia'
import {getloginApi} from "@/apis/login.js";

export const useUserstore = defineStore('user', () => {
        const userInfo = ref({})
        const getuser = async ({account,password}) => {
            const p = await getloginApi({account,password})
            userInfo.value  = p.data.result
        }
        const clearuser = ()=>{
            userInfo.value = {}
        }

        return { userInfo , getuser , clearuser }
},{ persist: true})
